
package src.origintrail;

import java.util.ArrayList;

/**
 * The massively important event creator class!
 * @author csmythe
 */
public class EvtSpawner {
    private EvtHandler handler;
    /**
     * The only instance of this class that can exist...
     */
    public static final EvtSpawner instance = new EvtSpawner();
    
    /**
     * Constructor. Initiates the handler.
     */
    private EvtSpawner(){
        handler = new EvtHandler();
    }
    
    /**
     * Creates a buy
     * @param i The bought item
     */
    public void spawnBuyEvent(Item i){
        handler.add(new EventBuy(i));
    }
    
    /**
     * A multiple item buy
     * @param i The item basket
     */
    public void spawnBuyEvent(Item[] i){
        for(Item iter: i)
            spawnBuyEvent(iter);
    }
    /**
     * A multiple item buy
     * @param i The item basket
     */
    public void spawnBuyEvent(ArrayList i){
        for(int loop = 0; loop < i.size(); loop++)
            spawnBuyEvent((Item)i.get(loop));
    }
    
    /**
     * Player enters a shop
     */
    public void spawnShopEvent(){
        handler.add(new EventShopEnter());
    }
    
    /**
     * Starts the game
     */
    public void spawnStartEvent(){
        handler.add(new EventStartup());
    }

    /**
     * Getter for the event handler
     * @return The event handler
     */
    public EvtHandler getHandler() {
        return handler;
    }

    /**
     * Spawns a move event
     */
    public void spawnMoveEvent() {
        handler.add(new EventMove());
    }
    
    /**
     * Spawns an end event
     */
    public void spawnEndEvent() {
        handler.add(new EventEnd());
    }
	
    public void spawnRandomEvent(){/*CHRIS FIX THS*/
            handler.add(new EventRandom());
    }

    public void spawnDieEvent() {
        handler.add(new EventDie());
    }
}
